# 计科201132叶英杰
# dic1={"name":"小明","age":20}
# print(dic1["name"])
# # print(dic1["gender"])
# print(dic1.get("gender"))
# print(dic1.get("age",18))
# print(dic1.get("height",170))
# print(dic1)
contacts = {}
while True:
    print("-"*50+"通讯录系统"+"-"*50)
    print("1.添加联系人"+" "+"2.删除联系人"+" "+"3.修改联系人"+" "+"4.查询联系人"+" "+"5.退出系统"+"6.查看所有联系人")
    index = input("请选择功能：")
    if index == "1":
        name = input("请输入联系人姓名：")
        number = input("请输入联系人电话：")
        contacts[name] = number
        print("已添加")
    elif index == "2":
        name = input("请输入要删除的联系人姓名：")
        if name in contacts:
            del contacts[name]
            print("已删除")
        else:
            print("联系人不存在")
    elif index == "3":
        name = input("请输入要修改的联系人姓名：")
        if name in contacts:
            number = input("请输入新的联系人电话：")
            contacts[name] = number
        else:
            print("联系人不存在")
    elif index == "4":
        name = input("请输入要查询的联系人姓名：")
        if name in contacts:
            print("联系人姓名：{}，联系人电话：{}".format(name,contacts[name]))
        else:
            print("联系人不存在")
    elif index == "5":
        break
    elif index == "6":
        print(contacts)


